package com.load.controller;

import com.load.service.UpLoadService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import java.io.IOException;

/**
 * Created by 78397 on 2019/11/8.
 */

@RestController
public class UpLoadController {

    @Autowired
    private UpLoadService upLoadService;


    /**
     * 上传图片
     * @param file
     * @return
     * @throws java.io.IOException
     */
    @RequestMapping(value = "upLoadImg", produces = {"text/javascript;charset=UTF-8"}, method = RequestMethod.POST)
    @ResponseBody
    public String upLoadImg(MultipartFile file)throws IOException {
        return upLoadService.uploadImg(file);
    }
}
